#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
using namespace std;
class Solution {
public:
    vector<int> solve(int n, int m, vector<int>& a)
    {
        while (m--)
        {
            int back = a.back();
            a.insert(a.begin(), back);
            a.pop_back();
        }
        return a;
    }
};